#include "ecb/base/Benchmark.h"
#include "ecb/base/Problem.h"

namespace ecb {

    Benchmark::Benchmark(const std::string& name) : _name(name) { }

    Benchmark::~Benchmark() {
        for (size_t i = 0; i < _problems.size(); ++i) {
            delete _problems[i];
        }
    }

    std::string Benchmark::name() const {
        return this->_name;
    }

    void Benchmark::addProblem(Problem* problem) {
        this->_problems.push_back(problem);
    }

    void Benchmark::insertProblem(Problem* problem, int index) {
        this->_problems.insert(this->_problems.begin() + index, problem);
    }

    Problem* Benchmark::getProblem(int index) const {
        return this->_problems[index];
    }

    Problem* Benchmark::removeProblem(int index) {
        Problem* result = this->_problems[index];
        this->_problems.erase(this->_problems.begin() + index);
        return result;
    }

    int Benchmark::numberOfProblems() const {
        return this->_problems.size();
    }

    const std::vector<Problem*>& Benchmark::problems() const {
        return this->_problems;
    }



}
